var fs = require('fs');

exports.initImgArray = function(url) {
	var array = new Array();
	fs.readdirSync('.' + url).forEach((val, index) => {
		if(val != ".svn") array.push({
			name: val.split(".")[0],
			url: (val)
		});
	})
	return array;
}

exports.deleteFile = function(url) {
	url = __dirname + "/" + url;
	//判断给定的路径是否存在
	if(fs.existsSync(url)) {
		fs.unlinkSync(url);
		//fs.rmdirSync(url);
	} else {
		console.log("给定的路径不存在，请给出正确的路径");
	}
};